package com.example.mapper;

import com.example.entity.ZyzSignUp;
import com.example.entity.vo.ZyzSignUpVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 报名Mapper
 */
public interface ZyzSignUpMapper {

    /**
     * 查询所有
     * @param zyzSignUp
     * @return
     */
    List<Map<String, Object>> selectAll(ZyzSignUp zyzSignUp);

    /**
     * 根据学生id和活动id查询
     * @param studentId
     * @param activityId
     * @return
     */
    @Select("select * from zyz_sign_up where student_id = #{studentId} and activity_id = #{activityId}")
    ZyzSignUp selectByStudentIdAndActivityId(@Param("studentId") Integer studentId, @Param("activityId") Integer activityId);

    /**
     * 报名
     * @param zyzSignUp
     * @return
     */
    int insert(ZyzSignUp zyzSignUp);

    /**
     * 批量删除
     * @param toStrArray
     * @return
     */
    int deleteBatch(String[] toStrArray);

    /**
     * 根据学生id查询
     * @param studentId
     * @return
     */
    @Select("select * from zyz_sign_up where student_id = #{studentId}")
    List<ZyzSignUp> selectByStudentId(Integer studentId);

    /**
     * 根据学生id查询报名次数
     * @param studentId
     * @return
     */
    @Select("select count(*) from zyz_sign_up where student_id = #{studentId}")
    Integer countByStudentId(Integer studentId);

    /**
     * 根据id查询报名
     * @param studentId
     * @return
     */
    @Select("select * from zyz_sign_up where student_id = #{studentId}")
    List<ZyzSignUp> selectNotice(Integer studentId);

    List<Map<String, Object>> selectStudentActivity(Integer studentId);
}
